package com.darwin.darwinDisplay
{
	/**
	 * DarwinBitmapData 动画数据
	 * 包含三张位图和动画信息 
	 * @author jasonwluck
	 * 
	 */	
	public class DarBitmapData
	{
		private var _darwinUp:Object;
		private var _darwinMid:Object;
		private var _darwinDown:Object;
		private var _key:String;
		private var _totalLayer:int;
		
		public function DarBitmapData()
		{
			
		}
		
		public static function parseData(key:String,obj:Object):DarBitmapData
		{
			if(!obj){return null;};
			var returnDarwinBitmapData:DarBitmapData = new DarBitmapData();
			returnDarwinBitmapData.key = key;
			if(obj.hasOwnProperty("UP"))
			{
				returnDarwinBitmapData.totalLayer += 1;
				returnDarwinBitmapData.darwinUp = obj["UP"];
			}
			
			if(obj.hasOwnProperty("MID"))
			{
				returnDarwinBitmapData.totalLayer += 1;
				returnDarwinBitmapData.darwinMid = obj["MID"];
			}
			
			if(obj.hasOwnProperty("DOWN"))
			{
				returnDarwinBitmapData.totalLayer += 1;
				returnDarwinBitmapData.darwinDown = obj["DOWN"];
			}
			return returnDarwinBitmapData;
		}

		/**
		 * 下层动画数据 
		 */
		public function get darwinDown():Object
		{
			return _darwinDown;
		}

		/**
		 * 中层动画数据
		 */
		public function get darwinMid():Object
		{
			return _darwinMid;
		}

		/**
		 * 上层动画数据
		 */
		public function get darwinUp():Object
		{
			return _darwinUp;
		}

		public function set darwinUp(value:Object):void
		{
			_darwinUp = value;
		}

		public function set darwinMid(value:Object):void
		{
			_darwinMid = value;
		}

		public function set darwinDown(value:Object):void
		{
			_darwinDown = value;
		}

		/**
		 * 资源类名 
		 */
		public function get key():String
		{
			return _key;
		}

		/**
		 * @private
		 */
		public function set key(value:String):void
		{
			_key = value;
		}

		/**
		 * 总共有多少层 
		 */
		public function get totalLayer():int
		{
			return _totalLayer;
		}

		/**
		 * @private
		 */
		public function set totalLayer(value:int):void
		{
			_totalLayer = value;
		}
	}
}